package com.phf.vhr.web.controller;

import com.phf.vhr.model.req.UserReq;
import com.phf.vhr.web.utils.Result;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * 登录控制
 *
 * @program: vhr-master
 * @description:
 * @author: Peng houfu
 * @create: 2021-09-24 15:25
 **/
@RestController
@RequestMapping("/admin")
public class LoginController {

    /**
     * 登录 
     * @return
     */
    @PostMapping("/login")
    public Result<String> login(@RequestBody UserReq userReq){
        return Result.success("登录成功");
    }

    /**
     * admin 的hello
     * 
     * @return
     */
    @GetMapping("/hello")
    @PreAuthorize("hasAnyRole('user','admin')")
    public Result<String> hello(){
        return Result.success("hello");
    }
    
}
